import uvicorn
from fastapi import FastAPI,Depends
# 首先引入环境变量
from config import get_settings
# 中间件
from app.middlewares import register_middleware
# 全局依赖
from app.dependencies import register_dependencies
# docs 文档
from app.api import get_tags_metadata
from app.utils.registers import register_all
# 生命周期
from app.core.lifespan import lifespan
app = FastAPI(
    **get_settings(),
    middleware= register_middleware(), # 中间件
    dependencies= register_dependencies(),  # 全局依赖
    openapi_tags=get_tags_metadata(), # docs文档
    lifespan=lifespan,  # 生命周期
    docs_url=None,
    redoc_url=None,
)

# 相关注册
register_all(app)


if __name__ == "__main__":
    # uvicorn.run(app, host="127.0.0.1", port=9001)
    uvicorn.run(app, host="0.0.0.0", port=9001)
